<template>
    <view class="bg-content">

        <div style="background-color: white; margin-bottom: 10px;"
             v-for="(tbOrderGoodsAfterSale, index) in dataList" :key="tbOrderGoodsAfterSale.id"
             @click="navigateTo(`/pages/sub/sub1-tabs/tabs/person/goods-after-sale/goods-after-sale-detail/index`, null, tbOrderGoodsAfterSale)">

            <u-cell-item :arrow="false" use-label-slot :title-style="{'width': '100%'}">
                <div slot="icon">
                </div>
                <div slot="title">
                    <div style="display: flex;">
                        <div style="width: 100%;">
                            服务单号：{{tbOrderGoodsAfterSale.code}}
                        </div>
                        <div style="text-align: right; color: grey; width: 70px;">
                            {{tbOrderGoodsAfterSale.afterSaleTypeText}}
                        </div>
                    </div>
                    <div style="display: flex">
                        <div>
                            <image :src="tbOrderGoodsAfterSale.tbOrderGoods.image ? tbOrderGoodsAfterSale.tbOrderGoods.image + '?imageView2/1/w/100/h/100' : '/pages/sub/sub2-store-platform/static/default-image/goods.jpg'"
                                   mode="aspectFill" style="width: 100px; height: 100px;"></image>
                        </div>
                        <div style="padding-left: 10px;">
                            <div style="font-size: 14px;">
                                {{ tbOrderGoodsAfterSale.tbOrderGoods.title }}
                            </div>
                            <div style="font-size: 12px; color: grey;">
                                {{tbOrderGoodsAfterSale.tbOrderGoods.specName}}
                                <label v-if="tbOrderGoodsAfterSale.tbOrderGoods.colorId">;{{tbOrderGoodsAfterSale.tbOrderGoods.colorName}}</label>
                            </div>
                            <div style="width: 100%; font-size: 12px;">
                                申请数量：{{tbOrderGoodsAfterSale.quantity}}
                            </div>
                        </div>
                    </div>
                    <div>
                        <u-alert-tips type="info" :description="`当前进度：${tbOrderGoodsAfterSale.progressText}`"></u-alert-tips>
                    </div>
                    <div style="text-align: right; margin-top: 10px;">
                        <u-button plain :type="'default'" size="medium" v-if="tbOrderGoodsAfterSale.progress === '0'"
                                  @click="navigateTo(`/pages/sub/sub2-store-platform/store-platform/store-platform-order-goods-after-sale/store-platform-order-goods-after-sale-feedback/index?progress=1`, null, tbOrderGoodsAfterSale)">
                            改为处理中
                        </u-button>
                        <u-button plain :type="'error'" size="medium" v-if="tbOrderGoodsAfterSale.progress === '0'"
                                  :custom-style="{'margin-left': '10px'}"
                                  @click="navigateTo(`/pages/sub/sub2-store-platform/store-platform/store-platform-order-goods-after-sale/store-platform-order-goods-after-sale-feedback/index?progress=4`, null, tbOrderGoodsAfterSale)">
                            拒绝售后申请
                        </u-button>
                    </div>
                </div>
                <div slot="label">
                </div>
                <div slot="right-icon">
                </div>
                <!--默认value属性-->
                <div>
                </div>
            </u-cell-item>
        </div>

        <div style="padding-top: 10px; padding-bottom: 10px;">
            <u-loadmore :status="pagination.status" bg-color="#eeeeee"/>
        </div>
    </view>
</template>

<script>

    import {TbOrderGoodsAfterSaleService} from "@/dev/services/tb-order-goods-after-sale.service";

    export default {
        data() {
            return {
                dataList: [],
                searchKeyword: '',
            }
        },
        methods: {
            /**
             * 加载更多数据中
             * @param infiniteScroll
             */
            doInfinite(infiniteScroll) {
                const _self = this;
                new TbOrderGoodsAfterSaleService().findTableListCascade({
                    pagination: this.pagination,
                    data: {
                        storeId: this.globalVariable.userInfo.tbStore.id,
                        afterSaleStatus: '0',  //  '售后状态：0-售后申请中，1-售后处理中，2-售后处理完成',
                        progress: '0',  // 进度：0-申请退款中，1-等待买家退货，2-买家已退货，等待商家处理，3-退款完成，4-拒绝退款申请，5-买家已撤销退款申请
                        orderBy: 'a.create_time desc',
                        searchKeyword: this.searchKeyword
                    }
                }).then(result => {
                    console.log(_self.dataList)
                    _self.pagination.refreshPage(result)
                    _self.dataList = [..._self.dataList, ...result.list]
                })
            },
        }
    }
</script>

<style lang="scss" scoped>
</style>
